package com.hina.rec.endpoint.req.system;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.util.List;

/**
 * 用户创建请求
 *
 * @author liaosp
 * @date 2024-01-10
 */
@Data
@Schema(description = "用户创建请求")
public class UserSaveReq {

    /**
     * 用户名
     */
    @Schema(description = "用户名", required = true)
    @NotBlank(message = "用户名不能为空")
    @Size(min = 4, max = 30, message = "用户名长度必须在4-30个字符之间")
    private String username;

    /**
     * 密码
     */
    @Schema(description = "密码", required = true)
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    private String password;

    /**
     * 真实姓名
     */
    @Schema(description = "真实姓名", required = true)
    @NotBlank(message = "真实姓名不能为空")
    @Size(max = 50, message = "真实姓名长度不能超过50个字符")
    private String realName;

    /**
     * 电子邮箱
     */
    @Schema(description = "电子邮箱")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 联系电话
     */
    @Schema(description = "联系电话")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码格式不正确")
    private String phone;

    /**
     * 头像URL或路径
     */
    @Schema(description = "头像URL或路径")
    private String avatar;

    /**
     * 状态（true-启用，false-禁用）
     */
    @Schema(description = "状态（true-启用，false-禁用）")
    private Boolean status;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 角色ID列表
     */
    @Schema(description = "角色ID列表", required = true)
    @NotEmpty(message = "角色ID列表不能为空")
    private List<Integer> roleIds;
}